/*! zgfApi.js
 * ================
 * AdminLTE Menu Creator
 * dependence on AdminLTE 2.1.2
 *
 * @Author  zengzhijun
 * @Support <http://www.almsaeedstudio.com>
 * @Email   <zzjvslove@qq.com>
 * @version 1.0.0
 * @license MIT <http://opensource.org/licenses/MIT>
 */

//请求前缀
//var baseURL = "/renren-fast/";
var baseURL = "http://localhost:8080";

//登录token
var token = localStorage.getItem("token");
if(token == 'null'){
    parent.location.href = 'login.html';
}

//jquery全局配置
$.ajaxSetup({
    dataType: "json",
    cache: false,
    headers: {
        "token": token
    },
    xhrFields: {
        withCredentials: true
    },
    complete: function(xhr) {
        //token过期，则跳转到登录页面
        if(xhr.responseJSON == null || xhr.responseJSON.code == 401){
            parent.location.href = '/login.html';
        }
    }
});


//权限判断
function hasPermission(permission) {
    // if (window.parent.permissions.indexOf(permission) > -1) {
        return true;
    // } else {
    //     return false;
    // }
}

//iframe自适应
$(window).on('resize', function() {
    var $content = $('.content');
    $content.height($(window).height() - 200);
    $content.find('iframe').each(function() {
        $(this).height($content.height());
    });
}).resize();





